package com.echo.im.common.vo;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;


import java.util.List;
import java.util.stream.Collectors;

/**
 *
 * @author echo
 * @date 2024-08-15
 */
@Data
public class GroupMessageVO extends MessageVO {

    private Long orderId;

    @Schema(description = "群聊id")
    private Long groupId;

    @Schema(description = " 发送者昵称")
    private String sendNickName;

    @Schema(description = "是否回执消息")
    private Boolean receipt;

    @Schema(description = "回执消息是否完成")
    private Boolean receiptOk;

    @Schema(description = "已读消息数量")
    private Integer readedCount;

    @Schema(description = "@用户列表")
    private String atUserIds;

    public void setAtUserIds(List<Long> atUserIdsList) {
        if (atUserIdsList != null && !atUserIdsList.isEmpty()) {
            this.atUserIds = atUserIdsList.stream()
                    .map(String::valueOf)
                    .collect(Collectors.joining(","));
        } else {
            this.atUserIds = null;
        }
    }

}
